//
//  XLCellLabel.m
//  Current
//
//  Created by 于鹏 on 2017/8/14.
//  Copyright © 2017年 YIVIEW. All rights reserved.
//

#import "XLCellLabel.h"
#import "XLAppMacro.h"
@implementation XLCellLabel

- (void)awakeFromNib {
    [super awakeFromNib];
    [self configUI];
}

- (instancetype)init {
    self = [super init];
    if (self) {
        [self configUI];
    }
    return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self configUI];
    }
    return self;
}

- (void)configUI {
    self.fontType = XLLabelFontNormal;
    self.textColorType = XLLabelTextColorBlack;
    self.numberOfLines = 0;
}

#pragma mark - Setter
- (void)setFontType:(XLLabelFontType)fontType {
    switch (fontType) {
        case XLLabelFontNormal:
            self.font = kXLDefaultFontSize;
            break;
        case XLLabelFontDetail:
            self.font = kXLDetailFontSize;
            break;
        default:
            break;
    }
}

//- (void)setFontType:(XLLabelFontType)fontType {
//    switch (fontType) {
//        case XLLabelFontNormal:
////            self.font = kXLDefaultFontSize;
//            
//            self.font = [UIFont systemFontOfSize:[self adaptWithFont:15]];
//            break;
//        case XLLabelFontDetail:
//            self.font = [UIFont systemFontOfSize:[self adaptWithFont:13]];
//            break;
//        default:
//            break;
//    }
//}

- (void)setTextColorType:(XLLabelTextColor)textColorType {
    switch (textColorType) {
        case XLLabelTextColorBlack:
            self.textColor = kXLTextColor_BLACK;
            break;
        case XLLabelTextColorGray:
            self.textColor = kXLTextColor_GRAY;
            break;
        default:
            break;
    }
}

#pragma mark - 自适应字体大小(基于4.7寸屏幕)
-(CGFloat)adaptWithFont:(CGFloat)font
{
    if (IS_3_5_SIZE) {
        font -= 3;
    }
    else if (IS_4_0_SIZE) {
        font -= 2;
    }
    else if (IS_4_7_SIZE) {
        font = font;
    }
    else {
        font += 1;
    }
    
    return font;
}

@end
